                            <div class="main">
                                <h3 class="title"><?=$clabel?> &raquo; <?=$mlabel?></h3>
                                <div class="formdiv">
                                    <form method="POST" id="frmAddStaff">
                                        <table>
                                            <? if( isset($errors) ) {
                                               foreach($errors as $error) {
                                               ?>
                                            <tr>
                                                <td class="errormsg" colspan="3">
                                                    <?=$error?>    
                                                </td>
                                            </tr>   
                                               <? 
                                               } 
                                            }  ?>
                                            <? if( isset($successes) ) {
                                               foreach($successes as $success) {
                                               ?>
                                            <tr>
                                                <td class="successmsg" colspan="3">
                                                    <?=$success?>    
                                                </td>
                                            </tr>   
                                               <? 
                                               } 
                                            }  ?>
                                            <tr>
                                                <td><label for="staff_name">Name*</label></td>
                                                <td>
                                                    <input type="text" class="text required" maxlength="25" minlength="3"  name="staff_name" value="<?=$postdata['staff_name']?>" />
                                                </td>
                                                <td></td>
                                            </tr>
                                            <tr>
                                                <td><label for="staff_type_id">Staff Type*</label></td>
                                                <td>
                                                    <select class="text required" name="staff_type_id">
                                                        <option value="">-- Select --</option>
                                                        <?
                                                            if(isset($stafftypelist) && is_array($stafftypelist) && count($stafftypelist) > 0) {
                            	                               foreach( $stafftypelist as $stafftype ) {
                            	                                   $sel = '';
                            	                                   if(isset($postdata["staff_type_id"]) && $stafftype["type_id"]==$postdata["staff_type_id"]) { $sel = "selected"; }
                                                        ?>
                                                                <option value="<?=$stafftype["type_id"]?>" <?=$sel?>><?=$stafftype["type_label"]?></option>
                                                        <?
                            	                           }
                                                        }
                                                        ?>
                                                    </select>
                                                </td>
                                                <td></td>
                                            </tr>
                                            <tr>
                                                <td><label>Gender*</label></td>
                                                <td>
                                                    <input value="m" <? if($postdata["staff_gender"] && $postdata["staff_gender"] == 'm' ) echo "checked=\"checked\""; ?> class="required" type="radio" id="radGM" name="staff_gender"/><label for="radGM">Male</label>
                                                    <input value="f" <? if($postdata["staff_gender"] && $postdata["staff_gender"] == 'f' ) echo "checked=\"checked\""; ?> type="radio" id="radGF" name="staff_gender"/><label for="radGF">Female</label>
                                                </td>
                                                <td></td>
                                            </tr>
                                            <tr>
                                                <td><label for="staff_marital_status">Marital Status*</label></td>
                                                <td>
                                                    <select class="text required" name="staff_marital_status">
                                                        <option value="">-- Select --</option>
                                                        <?
                                                            if(isset($maritalstatuslist) && is_array($maritalstatuslist) && count($maritalstatuslist) > 0) {
                            	                               foreach( $maritalstatuslist as $maritalstatus ) {
                            	                                   $sel = '';
                            	                                   if(isset($postdata["staff_marital_status"]) && $maritalstatus["status_id"]==$postdata["staff_marital_status"]) { $sel = "selected"; }
                                                        ?>
                                                                <option value="<?=$maritalstatus["status_id"]?>" <?=$sel?>><?=$maritalstatus["status_label"]?></option>
                                                        <?
                            	                           }
                                                        }
                                                        ?>
                                                    </select>
                                                </td>
                                                <td></td>
                                            </tr>
                                            <tr>
                                                <td><label for="staff_dob">Date Of Birth*</label></td>
                                                <td>
                                                    <input type="text" readonly="true" class="stext required {validate:{date:true}}" id="staff_dob" name="staff_dob" value="<?=$postdata['staff_dob']?>" />
                                                    <label>YYYY-MM-DD</label>
                                                </td>
                                                <td></td>
                                            </tr>
                                            <tr>
                                                <td><label for="staff_email">Email*</label></td>
                                                <td>
                                                    <input type="text" class="text required email" name="staff_email" value="<?=$postdata['staff_email']?>" />
                                                </td>
                                                <td></td>
                                            </tr>
                                            <tr>
                                                <td><label for="staff_mobile">Mobile*</label></td>
                                                <td>
                                                    <input type="text" class="text required digits" name="staff_mobile" value="<?=$postdata['staff_mobile']?>" />
                                                </td>
                                                <td></td>
                                            </tr>
                                            <tr>
                                                <td><label for="staff_telephone">Telephone</label></td>
                                                <td>
                                                    <input type="text" class="text digits" name="staff_telephone" value="<?=$postdata['staff_telephone']?>" />
                                                </td>
                                                <td></td>
                                            </tr>
                                            <tr>
                                                <td><label for="staff_address">Address*</label></td>
                                                <td>
                                                    <textarea rows="3" cols="20" class="text required" maxlength="200" minlength="10" name="staff_address"><?=$postdata['staff_address']?></textarea>
                                                </td>
                                                <td></td>
                                            </tr>
                                            <tr>
                                                <td><label for="staff_nationality">Nationality*</label></td>
                                                <td>
                                                    <select class="text required" name="staff_nationality">
                                                        <option value="">-- Select --</option>
                                                        <?
                                                            if(isset($countrylist) && is_array($countrylist) && count($countrylist) > 0) {
                            	                               foreach( $countrylist as $country ) {
                            	                                   $sel = '';
                            	                                   if(isset($postdata["staff_nationality"]) && $country["id"]==$postdata["staff_nationality"]) { $sel = "selected"; }
                                                        ?>
                                                                <option value="<?=$country["id"]?>" <?=$sel?>><?=$country["name"]?></option>
                                                        <?
                            	                           }
                                                        }
                                                        ?>
                                                    </select>
                                                </td>
                                                <td></td>
                                            </tr>
                                            <tr>
                                                <td><label for="staff_qualification">Qualification</label></td>
                                                <td>
                                                    <input type="text" class="text" name="staff_qualification" value="<?=$postdata['staff_qualification']?>" />
                                                </td>
                                                <td></td>
                                            </tr>
                                            <tr>
                                                <td><label for="staff_spouse_name">Spouse Name</label></td>
                                                <td>
                                                    <input type="text" class="text" name="staff_spouse_name" value="<?=$postdata['staff_spouse_name']?>" />
                                                </td>
                                                <td></td>
                                            </tr>
                                            <tr>
                                                <td><label for="staff_spouse_mobile">Spouse's Mobile</label></td>
                                                <td>
                                                    <input type="text" class="text" name="staff_spouse_mobile" value="<?=$postdata['staff_spouse_mobile']?>" />
                                                </td>
                                                <td></td>
                                            </tr>
                                            <tr>
                                                <td><label>Employment Status*</label></td>
                                                <td>
                                                    <input value="a" <? if($postdata["staff_status"] && $postdata["staff_status"] == 'a' ) echo "checked=\"checked\""; ?> class="required" type="radio" id="radSSA" name="staff_status"/><label for="radSSA">Active</label>
                                                    <input value="r" <? if($postdata["staff_status"] && $postdata["staff_status"] == 'r' ) echo "checked=\"checked\""; ?> type="radio" id="radSSR" name="staff_status"/><label for="radSSR">Resigned</label>
                                                </td>
                                                <td></td>
                                            </tr>
                                            <tr>
                                                <td><label for="staff_joining_date">Joining Date*</label></td>
                                                <td>
                                                    <input type="text" readonly="true" class="stext required {validate:{date:true}}" id="staff_joining_date" name="staff_joining_date" value="<?=$postdata['staff_joining_date']?>" />
                                                    <label>YYYY-MM-DD</label>
                                                </td>
                                                <td></td>
                                            </tr>
                                            <tr>
                                                <td><label for="staff_leaving_date">Releaved On</label></td>
                                                <td>
                                                    <input type="text" readonly="true" class="stext {validate:{date:true}}" id="staff_leaving_date" name="staff_leaving_date" value="<?=$postdata['staff_leaving_date']?>" />
                                                    <label>YYYY-MM-DD</label>
                                                </td>
                                                <td></td>
                                            </tr>
                                            <tr>
                                                <td><label for="staff_rp_no">RP No.*</label></td>
                                                <td>
                                                    <input type="text" class="text required" name="staff_rp_no" value="<?=$postdata['staff_rp_no']?>" />
                                                </td>
                                                <td></td>
                                            </tr>
                                            <tr>
                                                <td><label for="staff_rp_expiry">RP Expiry*</label></td>
                                                <td>
                                                    <input type="text" readonly="true" class="stext required {validate:{date:true}}" id="staff_rp_expiry" name="staff_rp_expiry" value="<?=$postdata['staff_rp_expiry']?>" />
                                                    <label>YYYY-MM-DD</label>
                                                </td>
                                                <td></td>
                                            </tr>
                                        	<tr>
                                        		<td></td>
                                        		<td colspan="2">
                                                    <input class="button" type="submit" name="btnAddStaff" value="Add" id="btnAddStaff" />
                                                    <input class="button" type="reset" value="Cancel" id="btnreset" />
                                                </td>
                                        	</tr>
                                        </table>
                                	</form>
                                    <script language="javascript" type="text/javascript">
                                        if(typeof jQuery == 'undefined') {
                                            alert('Invalid Request');
                                            window.location = "/";
                                        }
                                        $(document).ready( function() {
                                            
                                            $("#frmAddStaff").validate({
                                                errorPlacement: function(error, element) {
                                                    placeError(error, element);
                                                },
                                                submitHandler: function(form) {
                                                    var cui = $('#contenttabs .ui-tabs-panel:visible');                                                                                                        
                                               	    var jqxhr = $.post(
                                                        "/staff/addstaff", 
                                                        $("#frmAddStaff").serialize(), 
                                                        function (data) {
                                                            $(cui).html(data);
                                                        }
                                                    );
                                                    $(cui).html('<div id="loadingdiv"><div class="centerdiv"><strong>Processing</strong><br/><img src="/images/ajaxloader.gif" /></div></div>');
                                                }
                                            });
                                            $("input[name='staff_dob']").datepicker({ 
                                                yearRange: '-60:-16',
                                                dateFormat: 'yy-mm-dd',
                                                changeMonth: true,
                                                changeYear: true,
                                                maxDate: '+16y' 
                                            });
                                            $("input[name='staff_joining_date']").datepicker({ 
                                                dateFormat: 'yy-mm-dd',
                                                changeMonth: true,
                                                changeYear: true,
                                                maxDate: new Date() 
                                            });
                                            $("input[name='staff_leaving_date']").datepicker({ 
                                                dateFormat: 'yy-mm-dd',
                                                changeMonth: true,
                                                changeYear: true,
                                                maxDate: new Date() 
                                            });
                                            $("input[name='staff_rp_expiry']").datepicker({ 
                                                dateFormat: 'yy-mm-dd',
                                                changeMonth: true,
                                                changeYear: true
                                            });
                                            $("#frmAddStaff input[type='reset']").click( function() {
                                                $('#frmAddStaff label.error').remove();
                                            });
                                            
                                            
                                        });
                                    </script>
                                 </div>
                            </div>